export default function () {
    return {
        formData: null,
        options: {
            // inline:true,
            labelWidth: "80px",
            // style: { width: "700px" },
            // size: "small",
        },
        items: [
            {
                formItem: { label: "用户名", required: true },
                itemRender: {
                    el: "el-input",
                    placeholder: "请输入用户名",
                    value: "username",
                    style: { width: '220px' }
                },
            },
            {
                formItem: { label: "密码", required: true },
                itemRender: {
                    el: "el-input",
                    placeholder: "请输入密码",
                    value: "password",
                    style: { width: '220px' }
                },
            },
            {
                formItem: { label: "是否启用" },
                itemRender: {
                    el: "el-switch",
                    value: "state",
                    ['active-value']: 1,
                    ['inactive-value']: 0,
                    defVal: 1
                },
            },
            {
                formItem: { label: "角色", required: true },
                itemRender: {
                    el: "el-select",
                    placeholder: "角色",
                    multiple: true,
                    value: "roles",
                    defVal: [],
                    options: [],
                    style: { width: '220px' },
                    query: async (item) => {
                        const { result } = await this.$api.getRoleListAll();
                        item.options = result.map(item => {
                            return {
                                value: item.id,
                                label: item.roleName
                            }
                        })
                    }
                },
            },
        ],
        // rules: {
        // name: [
        //     { required: true, message: '请输入姓名', trigger: 'blur' },
        //     { min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' }
        // ],
        // age: [
        //     { required: true, message: '请输入年龄', trigger: 'blur' },
        // ],
        // gender: [
        //     { required: true, message: '请选择性别', trigger: 'change' }
        // ],
        // birthday: [
        //     { required: true, message: '请选择日期', trigger: 'change' }
        // ],
        // county: [
        //     { required: true, message: '请选择区域', trigger: 'change' }
        // ],
        // },
    }
}